<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>35 ES5构造函数继承</title>
</head>

<body>
    <script>
        //ES5
        function Phone(brand, price) {
            this.brand = brand;
            this.price = price;
        }

        Phone.prototype.call = function () {
            console.log('I can call');
        }

        // 
        function SmartPhone(brand, price, color, size) {
            Phone.call(this, brand, price);
            this.color = color;
            this.size = size;
        }

        SmartPhone.prototype = new Phone;
        SmartPhone.prototype.constructor = SmartPhone;

        SmartPhone.prototype.photo = function () {
            console.log('I can photo');
        }
        SmartPhone.prototype.play = function () {
            console.log('I can play game');
        }

        const chuizi = new SmartPhone('CZ', 2999, 'Black', 5.5);
        console.log(chuizi);
    </script>
</body>

</html>